package com.dqyt.lhq.controller;

import com.dqyt.khjc.bean.ResultMsg;
import com.dqyt.lhq.service.LhqReportePcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class LhqReportePcController {


    @Autowired
    private LhqReportePcService lhqReportePcService;

    /**
     * 分页查询样品
     * @param request 请求
     * @param pageNum  页数
     * @param pageSize  每页条数
     * @param reportStatue   报告状态
     * @param reportProgress   报告进度
     * @return
     */
    @RequestMapping(value = "/api/getLhqReoprtListPage", method = {RequestMethod.POST})
    public ResultMsg getLhqReoprtListPage(HttpServletRequest request,
                                          @RequestParam(defaultValue = "1") Integer pageNum,
                                          @RequestParam(defaultValue = "10") Integer pageSize,
                                          @RequestParam(name = "jlbh", required = false, defaultValue = "")  String jlbh,
                                          @RequestParam(name = "ccbh", required = false, defaultValue = "")  String ccbh,
                                          @RequestParam(name = "jlrId", required = false, defaultValue = "")  String jlrId,
                                          @RequestParam(defaultValue = "0") Integer reportStatue,
                                          @RequestParam(defaultValue = "0") Integer reportProgress

                                          ){

        ResultMsg resultMsg = lhqReportePcService.getLhqReoprtListPage(request,pageNum, pageSize, jlbh,ccbh,jlrId, reportStatue,reportProgress);
        return resultMsg;
    }



    /**
     * 分页查询样品
     * @param request 请求
     * @param pageNum  页数
     * @param pageSize  每页条数
     * @param reportStatue   报告状态
     * @param reportProgress   报告进度
     * @return
     */
    @RequestMapping(value = "/api/getLhqMeReoprtListPage", method = {RequestMethod.POST})
    public ResultMsg getLhqMeReoprtListPage(HttpServletRequest request,
                                          @RequestParam(defaultValue = "1") Integer pageNum,
                                          @RequestParam(defaultValue = "10") Integer pageSize,
                                          @RequestParam(name = "jlbh", required = false, defaultValue = "")  String jlbh,
                                          @RequestParam(name = "ccbh", required = false, defaultValue = "")  String ccbh,
                                          @RequestParam(defaultValue = "0") Integer reportStatue,
                                          @RequestParam(defaultValue = "0") Integer reportProgress

    ){

        ResultMsg resultMsg = lhqReportePcService.getLhqMeReoprtListPage(request,pageNum, pageSize, jlbh,ccbh, reportStatue,reportProgress);
        return resultMsg;
    }


    /**
     * 分页查询样品
     * @param request 请求
     * @param pageNum  页数
     * @param pageSize  每页条数
     * @param reportStatue   报告状态
     * @param reportProgress   报告进度
     * @return
     */
    @RequestMapping(value = "/api/getLhqPzReoprtListPage", method = {RequestMethod.POST})
    public ResultMsg getLhqPzReoprtListPage(HttpServletRequest request,
                                            @RequestParam(defaultValue = "1") Integer pageNum,
                                            @RequestParam(defaultValue = "10") Integer pageSize,
                                            @RequestParam(name = "jlbh", required = false, defaultValue = "")  String jlbh,
                                            @RequestParam(name = "ccbh", required = false, defaultValue = "")  String ccbh,
                                            @RequestParam(defaultValue = "0") Integer reportStatue,
                                            @RequestParam(defaultValue = "0") Integer reportProgress

    ){

        ResultMsg resultMsg = lhqReportePcService.getLhqPzReoprtListPage(request,pageNum, pageSize, jlbh,ccbh, reportStatue,reportProgress);
        return resultMsg;
    }




    /**
     * 删除报告
     * @param request
     * @param  bh
     * @return
     */
    @RequestMapping(value = "/api/mdelBGHgLhq", method = {RequestMethod.POST})
    public ResultMsg  mdelBGHgLhq(HttpServletRequest request,String bh){
        ResultMsg resultMsg = lhqReportePcService.mdelBGHgLhq(request,bh);
        return resultMsg;
    }



    /**
     * 修改报告的进度
     * @param request
     * @return
     */
    @RequestMapping(value = "/api/srtLhqReportProgress", method = {RequestMethod.POST})
    public ResultMsg  srtLhqReportProgress(HttpServletRequest request,String bh,int reportProgress){
        ResultMsg resultMsg = lhqReportePcService.srtLhqReportProgress(request,bh, reportProgress);
        return resultMsg;
    }





    /**
     * 分页查询样品
     * @param request 请求
     * @param pageNum  页数
     * @param pageSize  每页条数
     * @param reportStatue   报告状态
     * @param reportProgress   报告进度
     * @return
     */
    @RequestMapping(value = "/api/getLhqMeReoprtListPage2", method = {RequestMethod.POST})
    public ResultMsg getLhqMeReoprtListPage2(HttpServletRequest request,
                                            @RequestParam(defaultValue = "1") Integer pageNum,
                                            @RequestParam(defaultValue = "10") Integer pageSize,
                                            @RequestParam(name = "jlbh", required = false, defaultValue = "")  String jlbh,
                                            @RequestParam(name = "ccbh", required = false, defaultValue = "")  String ccbh,
                                            @RequestParam(defaultValue = "0") Integer reportStatue,
                                            @RequestParam(defaultValue = "0") Integer reportProgress

    ){

        ResultMsg resultMsg = lhqReportePcService.getLhqMeReoprtListPage2(request,pageNum, pageSize, jlbh,ccbh, reportStatue,reportProgress);
        return resultMsg;
    }



    /**
     * 驳回报告
     * @param request
     * @return
     */
    @RequestMapping(value = "/api/rejectLhqReportDal", method = {RequestMethod.POST})
    public ResultMsg  rejectLhqReportDal(HttpServletRequest request,String bh,int reportProgress,String bhgyy){
        ResultMsg resultMsg = lhqReportePcService.rejectLhqReportDal(request,bh, reportProgress,bhgyy);
        return resultMsg;
    }


    /**
     * 报告通过审核
     * @param request
     * @return
     */
    @RequestMapping(value = "/api/reportAdoptLhqExamine", method = {RequestMethod.POST})
    public ResultMsg  reportAdoptLhqExamine(HttpServletRequest request,String bh){
        ResultMsg resultMsg = lhqReportePcService.reportAdoptLhqExamine(request,bh);
        return resultMsg;
    }




    /**
     * 报告通过批准
     * @param request
     * @return
     */
    @RequestMapping(value = "/api/reportLhqAdoptApproval", method = {RequestMethod.POST})
    public ResultMsg  reportLhqAdoptApproval(HttpServletRequest request,String bh){
        ResultMsg resultMsg = lhqReportePcService.reportLhqAdoptApproval(request,bh);
        return resultMsg;
    }

}
